package com.aken.imdemo.model;

import com.aken.imdemo.R;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class EmotionData {
    private static LinkedHashMap<String, Integer> EMOTION_CLASSIC_MAP;

    public static LinkedHashMap<String, String> EMOTION_HTML_MAP;

    static {
        EMOTION_HTML_MAP = new LinkedHashMap<>();

        EMOTION_HTML_MAP.put("[微笑]","<img src=\"file:///android_asset/emotion_gif_0.gif\">" );
        EMOTION_HTML_MAP.put("[撇嘴]","<img src=\"file:///android_asset/emotion_gif_1.gif\">" );
        EMOTION_HTML_MAP.put("[色]",  "<img src=\"file:///android_asset/emotion_gif_2.gif\">");
        EMOTION_HTML_MAP.put("[流泪]", "<img src=\"file:///android_asset/emotion_gif_6.gif\">");
        EMOTION_HTML_MAP.put("[害羞]", "<img src=\"file:///android_asset/emotion_gif_7.gif\">");
        EMOTION_HTML_MAP.put("[闭嘴]", "<img src=\"file:///android_asset/emotion_gif_8.gif\">");
        EMOTION_HTML_MAP.put("[睡]",  "<img src=\"file:///android_asset/emotion_gif_9.gif\">");

        EMOTION_HTML_MAP.put("[大哭]", "<img src=\"file:///android_asset/emotion_gif_10.gif\">" );
        EMOTION_HTML_MAP.put("[尴尬]", "<img src=\"file:///android_asset/emotion_gif_11.gif\">" );
        EMOTION_HTML_MAP.put("[发怒]", "<img src=\"file:///android_asset/emotion_gif_12.gif\">" );
        EMOTION_HTML_MAP.put("[调皮]", "<img src=\"file:///android_asset/emotion_gif_13.gif\">" );
        EMOTION_HTML_MAP.put("[呲牙]", "<img src=\"file:///android_asset/emotion_gif_14.gif\">" );
        EMOTION_HTML_MAP.put("[惊讶]", "<img src=\"file:///android_asset/emotion_gif_15.gif\">" );
        EMOTION_HTML_MAP.put("[难过]", "<img src=\"file:///android_asset/emotion_gif_16.gif\">" );
        // empty 17
        EMOTION_HTML_MAP.put("[囧]",  "<img src=\"file:///android_asset/emotion_gif_18.gif\">" );
        EMOTION_HTML_MAP.put("[抓狂]", "<img src=\"file:///android_asset/emotion_gif_19.gif\">" );

        EMOTION_HTML_MAP.put("[吐]", "<img src=\"file:///android_asset/emotion_gif_20.gif\">" );
        EMOTION_HTML_MAP.put("[偷笑]","<img src=\"file:///android_asset/emotion_gif_21.gif\">" );
        EMOTION_HTML_MAP.put("[愉快]","<img src=\"file:///android_asset/emotion_gif_22.gif\">" );
        EMOTION_HTML_MAP.put("[白眼]","<img src=\"file:///android_asset/emotion_gif_23.gif\">" );
        EMOTION_HTML_MAP.put("[傲慢]","<img src=\"file:///android_asset/emotion_gif_24.gif\">" );

        //少35

        EMOTION_HTML_MAP.put("[困]", "<img src=\"file:///android_asset/emotion_gif_26.gif\">" );
        EMOTION_HTML_MAP.put("[惊恐]","<img src=\"file:///android_asset/emotion_gif_27.gif\">" );
        EMOTION_HTML_MAP.put("[流汗]","<img src=\"file:///android_asset/emotion_gif_28.gif\">" );
        EMOTION_HTML_MAP.put("[憨笑]","<img src=\"file:///android_asset/emotion_gif_29.gif\">" );
        EMOTION_HTML_MAP.put("[悠闲]", "<img src=\"file:///android_asset/emotion_gif_30.gif\">" );
        EMOTION_HTML_MAP.put("[奋斗]", "<img src=\"file:///android_asset/emotion_gif_31.gif\">" );
        EMOTION_HTML_MAP.put("[咒骂]", "<img src=\"file:///android_asset/emotion_gif_32.gif\">" );
        EMOTION_HTML_MAP.put("[疑问]", "<img src=\"file:///android_asset/emotion_gif_33.gif\">" );
        EMOTION_HTML_MAP.put("[嘘]", "<img src=\"file:///android_asset/motion_gif_34.gif\">" );
        EMOTION_HTML_MAP.put("[晕]", "<img src=\"file:///android_asset/motion_gif_35.gif\">" );

        //少36

        EMOTION_HTML_MAP.put("[衰]", "<img src=\"file:///android_asset/emotion_gif_37.gif\">" );
        EMOTION_HTML_MAP.put("[骷髅]", "<img src=\"file:///android_asset/emotion_gif_38.gif\">" );
        EMOTION_HTML_MAP.put("[敲打]", "<img src=\"file:///android_asset/emotion_gif_39.gif\">" );
        EMOTION_HTML_MAP.put("[再见]", "<img src=\"file:///android_asset/emotion_gif_40.gif\">" );
        EMOTION_HTML_MAP.put("[擦汗]", "<img src=\"file:///android_asset/emotion_gif_41.gif\">" );
        EMOTION_HTML_MAP.put("[抠鼻]", "<img src=\"file:///android_asset/emotion_gif_42.gif\">" );

        EMOTION_CLASSIC_MAP = new LinkedHashMap<>();

        EMOTION_CLASSIC_MAP.put("[微笑]", R.drawable.emotion_gif_0);
//        EMOTION_CLASSIC_MAP.put("<img src=\"file:///android_asset/emotion_gif_0.gif\">", R.drawable.emotion_gif_0);
        EMOTION_CLASSIC_MAP.put("[撇嘴]", R.drawable.emotion_gif_1);
        EMOTION_CLASSIC_MAP.put("[色]",  R.drawable.emotion_gif_2);
        EMOTION_CLASSIC_MAP.put("[流泪]", R.drawable.emotion_gif_6);
        EMOTION_CLASSIC_MAP.put("[害羞]", R.drawable.emotion_gif_7);
        EMOTION_CLASSIC_MAP.put("[闭嘴]", R.drawable.emotion_gif_8);
        EMOTION_CLASSIC_MAP.put("[睡]",   R.drawable.emotion_gif_9);

        EMOTION_CLASSIC_MAP.put("[大哭]", R.drawable.emotion_gif_10);
        EMOTION_CLASSIC_MAP.put("[尴尬]", R.drawable.emotion_gif_11);
        EMOTION_CLASSIC_MAP.put("[发怒]", R.drawable.emotion_gif_12);
        EMOTION_CLASSIC_MAP.put("[调皮]", R.drawable.emotion_gif_13);
        EMOTION_CLASSIC_MAP.put("[呲牙]", R.drawable.emotion_gif_14);
        EMOTION_CLASSIC_MAP.put("[惊讶]", R.drawable.emotion_gif_15);
        EMOTION_CLASSIC_MAP.put("[难过]", R.drawable.emotion_gif_16);
        // empty 17
        EMOTION_CLASSIC_MAP.put("[囧]",  R.drawable.emotion_gif_18);
        EMOTION_CLASSIC_MAP.put("[抓狂]", R.drawable.emotion_gif_19);

        EMOTION_CLASSIC_MAP.put("[吐]", R.drawable.emotion_gif_20);
        EMOTION_CLASSIC_MAP.put("[偷笑]", R.drawable.emotion_gif_21);
        EMOTION_CLASSIC_MAP.put("[愉快]", R.drawable.emotion_gif_22);
        EMOTION_CLASSIC_MAP.put("[白眼]", R.drawable.emotion_gif_23);
        EMOTION_CLASSIC_MAP.put("[傲慢]", R.drawable.emotion_gif_24);
        // empty 25
        EMOTION_CLASSIC_MAP.put("[困]", R.drawable.emotion_gif_26);
        EMOTION_CLASSIC_MAP.put("[惊恐]", R.drawable.emotion_gif_27);
        EMOTION_CLASSIC_MAP.put("[流汗]", R.drawable.emotion_gif_28);
        EMOTION_CLASSIC_MAP.put("[憨笑]", R.drawable.emotion_gif_29);

        EMOTION_CLASSIC_MAP.put("[悠闲]", R.drawable.emotion_gif_30);
        EMOTION_CLASSIC_MAP.put("[奋斗]", R.drawable.emotion_gif_31);
        EMOTION_CLASSIC_MAP.put("[咒骂]", R.drawable.emotion_gif_32);
        EMOTION_CLASSIC_MAP.put("[疑问]", R.drawable.emotion_gif_33);
        EMOTION_CLASSIC_MAP.put("[嘘]", R.drawable.emotion_gif_34);
        EMOTION_CLASSIC_MAP.put("[晕]", R.drawable.emotion_gif_35);
        // empty 36
        EMOTION_CLASSIC_MAP.put("[衰]", R.drawable.emotion_gif_37);
        EMOTION_CLASSIC_MAP.put("[骷髅]", R.drawable.emotion_gif_38);
        EMOTION_CLASSIC_MAP.put("[敲打]", R.drawable.emotion_gif_39);

        EMOTION_CLASSIC_MAP.put("[再见]", R.drawable.emotion_gif_40);
        EMOTION_CLASSIC_MAP.put("[擦汗]", R.drawable.emotion_gif_41);
        EMOTION_CLASSIC_MAP.put("[抠鼻]", R.drawable.emotion_gif_42);
    }

    private static String emojiString(int code) {
        return new String(Character.toChars(code));
    }

    public static int size() {
        return EMOTION_CLASSIC_MAP.size();
    }

    public static int getImgByName(String imgName) {
        Integer integer = EMOTION_CLASSIC_MAP.get(imgName);
        return integer == null ? -1 : integer;
    }

    public static List<EmotionItem> getNotes() {
        List<EmotionItem> notes = new ArrayList<>();

        for (Map.Entry<String, Integer> entry : EMOTION_CLASSIC_MAP.entrySet()) {
            notes.add(new EmotionItem(entry.getKey(), entry.getValue()));
        }

        return notes;
    }
}
